
import 'package:flutter/material.dart';
import 'package:flutterdemo01/demo3/pages/FirstNewsListPage.dart';
import 'package:flutterdemo01/demo3/utils/routess.dart';

main(){runApp(Demo21());}

class Demo21 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      routes: routes,
      // initialRoute: "/",//配置默认访问路径
      // onGenerateRoute:onGenerateRoute,  //必须加上这一行，固定写法
      theme: ThemeData(primaryColor: Colors.green),
      home: Scaffold(
        body: Mg(),
      ),
    );
  }
}

class Mg extends StatelessWidget {
  const Mg({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return  Column(
      children: [
        SizedBox(height: 200,),
        ElevatedButton(onPressed: (){
          // Navigator.of(context).push(
          //     MaterialPageRoute(builder: (context){return FirstNewsListPage(msg: 'sdjfklsjdfkjsdkjflsjdfl',);})
          // );
          Navigator.pushNamed(context, '/mm', arguments: {"id":102});
        }, child: Text('按钮')),
      ],
    );
  }
}


// class Mg extends StatefulWidget {
//   const Mg({Key? key}) : super(key: key);
//
//   @override
//   _MgState createState() => _MgState();
// }
//
// class _MgState extends State<Mg> {
//   @override
//   Widget build(BuildContext context) {
//     return Column(
//       children: [
//         SizedBox(height: 200,),
//         ElevatedButton(onPressed: (){
//           Navigator.of(context).push(
//             MaterialPageRoute(builder: (context){return FirstNewsListPage();})
//           );
//           // Navigator.pushNamed(context, '/mm');
//         }, child: Text('按钮')),
//       ],
//     );
//   }
// }
